package com.my.attendance.dao;

import com.my.attendance.entity.History;
import com.my.attendance.util.BaseDAO;

public class HistoryDao extends BaseDAO {

    public History getHistory(int employee_number) throws Exception {
        String sql="select * from history where employee_number=?;";
        Object[] obj={employee_number};
        History history = getOne(sql, new History(), obj);
        return history;
    }

    public int updateHistory(String status,int employee_number) throws Exception {
        String sql="update history set status=? where employee_number=?;";
        Object[] obj={status,employee_number};
        int i = addOrupdOrdel(sql, obj);
        return i;
    }

    public int deleteHistory(int employee_number) throws Exception {
        String sql="delete from history where employee_number=?;";
        Object[] obj={employee_number};
        int i = addOrupdOrdel(sql, obj);
        return i;
    }
}
